/*
 * @Description:
 * @Version:
 * @Author: Troubadour
 * @Date: 2022-10-11 19:07:52
 * @LastEditors: Troubadour
 * @LastEditTime: 2022-10-11 19:50:12
 */

#ifndef  __KALMAN_H__
#define  __KALMAN_H__

#include "main.h"

#define KALMAN_INIT_SOC         (0.01)
#define KALMAN_INIT_CNT         (50)


typedef struct
{
    double Last_P;  // 上次估算协方差
    double Now_P;   // 当前估算协方差
    double Q;       // 过程噪声协方差，Q增大，动态响应变快，收敛稳定性变坏
    double R;       // 观测噪声协方差，R增大，动态响应变慢，收敛稳定性变好
    double K;       // 卡尔曼增益
    double Out;     // 卡尔曼滤波器输出
}kalmanTypeDef;


void kalman_Filter(kalmanTypeDef *kalman, double value);
void Kalman_init(kalmanTypeDef *kalman, double value);

#endif  /* __KALMAN_H__ */
